//
//  CustomPageControl.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/11/1.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "CustomPageControl.h"

@implementation CustomPageControl

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.userInteractionEnabled = NO;
    }
    return self;
}
-(void)setCurrentPage:(NSInteger)currentPage{
    [super setCurrentPage:currentPage];
    
    for (NSUInteger subviewIndex = 0; subviewIndex < [self.subviews count]; subviewIndex++) {
        
        UIImageView* subview = [self.subviews objectAtIndex:subviewIndex];
       
       CGSize size;
       
       size.height = 5;
       
       size.width = 15;
       
       [subview setFrame:CGRectMake(subview.frame.origin.x, subview.frame.origin.y,size.width,size.height)];
        
        if (subviewIndex == currentPage)
            
            //        subview.image =[UIImage imageNamed:@"60.png"];
        {    subview.layer.cornerRadius = 0;
            subview.layer.masksToBounds = YES;
        }
        else
        {    //subview.image =[UIImage imageNamed:@"60.png"];
            subview.layer.cornerRadius = 0;
            subview.layer.masksToBounds = YES;
            
        }
    }
}
@end
